	<include file='Common:header' />

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">

			<!-- #section:basics/sidebar -->

	<include file='Common:left' />
			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">
							<div class="row">
							    <div class="col-xs-12">
										<div>
                                        <form id="leftnav" name="leftnav" method="post" action="" >
                                        <input type="hidden" name="checkk" id="checkk" value="1" /><!--用于判断操作类型-->
											<table id="dynamic-table" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
														<th width="5%" class="center">
															<label class="pos-rel">
																<input type="checkbox" class="ace"  id='chkAll' onclick='CheckAll(this.form)' value="全选"/>
															<span class="lbl"></span>
															</label>
														</th>
													  <th width="37%">导航标题</th>
													  <th width="16%">操作方法</th>
													  <th width="13%">开启状态</th>
													  <th width="13%">排序</th>
													  <th width="22%" style="border-right:#CCC solid 1px;">操作</th>
												  </tr>
												</thead>

												<tbody>
                                                
                                                <foreach name="arr" item="v">
													<tr>
														<td class="center">
															<label class="pos-rel">
																<input name='left_id[]' id="navid" class="ace"  type='checkbox' value='{$v.adminnav_id}'>
																<span class="lbl"></span>
															</label>
														</td>

														<td <if condition='$v.leftpin neq 0'>style=padding-left:{$v.leftpin}px;</if> ><span <if condition="$v.leftpin eq ''">style="color:#000"</if> <if condition="$v.leftpin eq 20">style="color:#333"</if> <if condition="$v.leftpin eq 40">style="color:#666"</if>>{$v.lefthtml}{$v.adminnav_title}</span> <strong>(ID：{$v.adminnav_id})</strong></td>
														<td>{$v.adminnav_url}</td>
														<td><if condition="$v['adminnav_open'] eq 1">开启<else/><span class="red">禁用</span></if></td>
														<td><input name="{$v.adminnav_id}" value=" {$v.adminnav_order}" class="list_order"/></td>
														<td>
															<div class="hidden-sm hidden-xs action-buttons">
                                                            	<a class="blue" href="{:U('leftnavadd',array('adminnav_leftid'=>$v['adminnav_id']))}"  title="添加子类">
																	<i class="ace-icon fa fa-plus-circle bigger-130"></i>
																</a>
																<a class="blue" href="javascript:;" onclick="return look('{$v.adminnav_title}','{$v.adminnav_url}','{$v.adminnav_order}');"  title="添加子类别">
																	<i class="ace-icon fa fa-search-plus bigger-130"></i>
																</a>
																<a class="green" href="{:U('leftnavedit',array('adminnav_id'=>$v['adminnav_id']))}" title="修改">
																	<i class="ace-icon fa fa-pencil bigger-130"></i>
																</a>
																<a class="red" href="javascript:;" onclick="return del({$v.adminnav_id});" title="删除">
																	<i class="ace-icon fa fa-trash-o bigger-130"></i>
																</a>
															</div>
														</td>
													</tr>
                                                 </foreach>   
                                                  <tr>
													  <td colspan="2" align="left"><button  id="btnsubmit" class="btn btn-white btn-yellow btn-sm">删</button>&nbsp;<button  id="btnorder" class="btn btn-white btn-yellow btn-sm">排序</button></td>
													  <td colspan="5"></td>
												  </tr>
												</tbody>
											</table>
                                            </form>
							    		</div>
									</div>
								</div>

<include file='Common:header_nav' />

					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->


<script>
$(function(){
$("#btnsubmit").click(function(){
$('#checkk').attr('value',1);
$('#leftnav').attr("action", "{:U('leftnavalldel')}");
});

$("#btnorder").click(function(){
$('#checkk').attr('value',0);
$('#leftnav').attr("action", "{:U('leftnavorder')}");
});
});


function del(id){
		layer.confirm('你确定要删除吗？', {icon: 3}, function(index){
	    layer.close(index);
	    window.location.href="__URL__/leftnavdel/adminnav_id/"+id+"";
	});
}

function look(title,url,order,opentype){
layer.open({
    type: 1,
	title: '查看信息',
    skin: 'layui-layer-rim', //加上边框
    area: ['420px', '240px'], //宽高
    content: "<div class=look><ul><li>导航标题："+title+"</li><li>U方法操作："+url+"</li><li>列表排序："+order+"</li></ul></div>"
});
}
</script>
<script>
function unselectall(){
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.Name != 'chkAll'&&e.disabled==false)
e.checked = form.chkAll.checked;
}
}

</script>
<script>
$(function(){
	$('#leftnav').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function checkForm(){
		if($('#checkk').val()==1){	
			if( '' == $.trim($('#adminnav_title').val())){
				var chk_value =[];    
				$('input[id="navid"]:checked').each(function(){    
					chk_value.push($(this).val());    
				});
				
				if(!chk_value.length){
					layer.alert('至少选择一个删除项', {icon: 6}); 
					return false;
				}
			}	
		}
	}
	 
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href="{:U('Sys/leftnav')}";
			});
		}else{
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href="{:U('Sys/leftnav')}";
			});
		}
	}
 
});
</script>
	<include file='Common:footer' />
    
		</div><!-- /.main-container -->
	</body>
</html>
